package kr.hkit.androidcomplete03.ch20;

import kr.hkit.androidcomplete03.R;
import kr.hkit.androidcomplete03.ch20.FragmentEx.CounterFragment;
import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class FragmentArgumentEx extends Activity {
	EditText startNum;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch20_fragment_argumentex);
		
		startNum = (EditText) findViewById(R.id.ch20_argument_fragment_edit);
	}
	
	public void mOnClick(View v){
		switch(v.getId()){
		case R.id.ch20_argument_fragment_btn:
			CounterFragment CF = new CounterFragment();
			Bundle args = new Bundle();
			args.putInt("start", Integer.parseInt(startNum.getText().toString()));
			CF.setArguments(args);
			getFragmentManager().beginTransaction().add(R.id.ch20_argument_frament_frame, CF, "count").commit();
			break;
			

		}
	}
	
}
